//
//  LzwIndexDetailCell.m
//  CoJellyCartoon
//
//  Created by 刘志武 on 16/4/5.
//  Copyright © 2016年 CJG. All rights reserved.
//

#import "LzwIndexDetailCell.h"

@interface LzwIndexDetailCell ()

@property (nonatomic, strong) UIImageView *myImageView;
@property (nonatomic, strong) UILabel *lableTitle;
@property (nonatomic, strong) UILabel *lableContent;
@property (nonatomic, strong) UILabel *lableTime;

@end

@implementation LzwIndexDetailCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatSubViewsD];
    }
    
    return self;
}

- (void)creatSubViewsD{
    
    self.myImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:self.myImageView];
    
    self.lableTitle = [[UILabel alloc]init];
    [self.contentView addSubview:self.lableTitle];
    
    self.lableTime = [[UILabel alloc]init];
    self.lableTime.textAlignment = 1;
    [self.contentView addSubview:self.lableTime];
    
    self.lableContent = [[UILabel alloc]init];
    self.lableContent.font = [UIFont systemFontOfSize:14];
    self.lableContent.numberOfLines = 0;
    self.lableContent.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.lableContent];
    
    [self.myImageView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.left.equalTo(self.contentView).offset(5);
        make.width.mas_equalTo(120);
        make.height.mas_equalTo(140);
        
    }];
    
    [self.lableTitle mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.contentView).offset(10);
        make.left.equalTo(self.myImageView.mas_right).offset(20);
        make.width.mas_equalTo(150);
        make.height.mas_equalTo(20);
        
        
    }];
    
    [self.lableContent mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.lableTitle.mas_bottom).offset(10);
        make.left.equalTo(self.myImageView.mas_right).offset(10);
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(70);
        
    }];
    
    [self.lableTime mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.lableContent.mas_bottom).offset(10);
        make.left.equalTo(self.myImageView.mas_right).offset(10);
        make.width.equalTo(self.lableContent);
        make.height.mas_equalTo(20);
        
    }];
    
    
}


-(void)setModleDetail:(LzwIndexDetailModle *)modleDetail{
    
    
    _modleDetail = modleDetail;
    
    NSURL *url = [NSURL URLWithString:_modleDetail.cover];
    [self.myImageView sd_setImageWithURL:url placeholderImage:nil];
    
    self.lableTitle.text = _modleDetail.title;
    self.lableContent.text = _modleDetail.brief;
    self.lableTime.text = _modleDetail.pub_time;
    
    
}


@end
